The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

Executing applications (exec)

asked Aug 28 '12

lzap gravatar image

updated Aug 28 '12

Hi, i3 docs states:

What good is a window manager if you can’t actually start any applications? The exec command starts an application by passing the command you specify to a shell. This implies that you can use globbing (wildcards) and programs will be searched in your $PATH.

Couple of questions:

  • which shell is used (I assume user's default shell)
  • can I use everything that is available in full shell (like variables, pipes, multiple commands separated with ; and other things)
  • its the i3 process that spawns them right?

Because for some reason this is not working for me:

 bindsym Control+Mod1+l exec i3-msg workspace 1; i3lock -c 111111 -d

and only the first command is executed.

Comments

I found that && instead ; works but I am interested in limitations. Thanks!

lzap gravatar imagelzap (Aug 28 '12)edit

When you are using semicolon `;` all commands will be executed regardless of their exit code. When you are using `&&` and one of the commands fail, remaining ones won't be executed.

MeanEYE gravatar imageMeanEYE (Mar 5 '13)edit

1 answer

Sort by » oldest newest most voted
1

answered Aug 28 '12

Michael gravatar image
  1. $SHELL is used (if set), otherwise /bin/sh. See http://code.stapelberg.de/git/i3/tree...
  2. Yes. i3 calls $SHELL -c <your command>
  3. Yes.

The reason your bindsym doesn’t work is because ; is the separator for i3 commands. Use exec "i3-msg workspace 1; i3lock -c 111111 -d (with double quotes) instead:

midna ~ $ i3 'exec "echo foo > /tmp/bar; echo bar > /tmp/baz"'
2012-08-28 12:56:15 - Additional arguments passed. Sending them as a command to i3.
[{"success":true}]
midna ~ $ cat /tmp/bar /tmp/baz                               
foo
bar

Comments

Thank you for nice explanation and big patience with me. But it seems other folks in our team are interested in i3 too ;-)

lzap gravatar imagelzap (Aug 28 '12)edit

Is it still the case? The code comment in http://code.stapelberg.de/git/i3/tree/src/startup.c?h=next#n136 is quite misleading because _PATH_BSHELL seems to be used everywhere.

Julien Jehannet gravatar imageJulien Jehannet (Mar 13 '14)edit

Question Tools

1 follower

Stats

Asked: Aug 28 '12

Seen: 3,194 times

Last updated: Aug 28 '12